package com.open.custom.api.config;

import com.open.custom.api.config.properties.LocalFsProperties;
import com.open.custom.api.service.business.OssClient;
import com.open.custom.api.service.business.impl.LocalFsOssClientAdapter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@AutoConfiguration
@Configuration
@ConditionalOnProperty(prefix = "srv.oss", name = "factory")
@EnableConfigurationProperties({LocalFsProperties.class})
public class OssConfig {

    @Bean
    @ConditionalOnProperty(prefix = "srv.oss", name = "factory", havingValue = "local")
    public OssClient getLocalFsOssClient(LocalFsProperties localFsProperties) {
        return new LocalFsOssClientAdapter(localFsProperties);
    }
}